var mainScroll,bankScroll,isBuy=true,isInputVal=false,inputId="",isIphoneOS;

$(document).ready(function(){
	// 判断当前移动设备的操作系统类型
	var userAgent = navigator.userAgent.toLocaleLowerCase();
	isIphoneOS = userAgent.match(/iphone os/i) == "iphone os";
	// 初始化基金详细页面
	initCompont();

	// 页面输入校验
	validateData();
	
	// 当输入框获取到焦点的时候，tab页面不可以点击
	noResizeForInput();
	
	// 在页面发生变化的时候重置页面的滚动和高度
	resetPageScroll();
	
	// 返回首页
	returnHome();
});
function resetPageScroll(){
	// 在页面发生变化的时候重置页面的滚动和高度
	$(window).on("resize",function(){
		if(!isIphoneOS){
			setTimeout(function(){
				mainIscroll();
				mainScroll.refresh();
				if(isInputVal && inputId != ""){
					//document.getElementById(inputId).focus();
					mainScroll.scrollToElement(document.getElementById(inputId),100);
					isInputVal = false;
				}
			},250);
		}
	});
}
// 初始化基金详细页面
function initCompont(){
	var sessionKey = getSessionKey("sessionKey");
	var fundInitFlag = getSessionKey("fundInitFlag");
	// url地址为：当已授权未登录情况下需要进行UM+OTP验证登录 如果登录成功直接进入到主界面
	var successForwardUrl = "/mobile/myfund/mszq.html?sessionKey="+sessionKey+"&fundInitFlag=Y";
	// 初始化提示信息
	initPrompt("<img src='../images/loading.gif' width='70px' height='70px'/>");
	$.ajax({
		type: "post",
		url: mpsurl +"/mobile/fund/fundIndex.do",
		dataType: "text",
		data:{sessionKey:sessionKey,fundInitFlag:fundInitFlag},
		success: function(data){
			var fundDetail = eval("("+data+")");
			var resultCode = fundDetail.resultCode;
			if(resultCode == "500600"){
				// 是否已经授权：值有Y已授权，N未授权，F为已授权却没有otp登录
				var accreditFlag = fundDetail.accreditFlag;
				if(accreditFlag == "Y"){
					// 登录令牌
					$("#sessionKey").val(sessionKey);
					// 每七日收益
					var incomeratio = fundDetail.incomeratio;
					$("#preIncome").text(incomeratio);
					// 基金名称
					var fundName = fundDetail.fundName;
					$("#fundName").text(fundName);
					$("#fundNameSale").text(fundName);
					// 基金ID 
					var fundCode = fundDetail.fundCode;
					$("#fundId").val(fundCode);
					// 总资产
					var totalcapital = fundDetail.totalcapital;
					$("#totalAsset").text(totalcapital);
					// 总收益
					var totalincome = fundDetail.totalincome;
					$("#totalIncome").text(totalincome);
					// 基金银行账号信息
					//var bankNameAccount = fundDetail.bankNameAccount;
					//$("#bankInfo").text(bankNameAccount);
					//$("#bankInfoSale").text(bankNameAccount);
					//可回收的份额
					//var ftmaxsharelimit = fundDetail.ftmaxsharelimit;
					//$("#saleLot").text(ftmaxsharelimit);
					// 基金银行账号ID
					var tradeacco = fundDetail.tradeacco;
					$("#tradeacco").val(tradeacco);
					// 添加滚动效果
					mainIscroll();
					mainScroll = new iScroll("content",{bounce:false});
					// 初始化银行列表
					initBankList(sessionKey);
				}else if(accreditFlag == "N"){
					var fundLoginNumber = fundDetail.fundLoginNumber;
					var fundCertificatetype = fundDetail.fundCertificatetype;
					var phoneNum = fundDetail.mobile;
					$("#initMessageBox").css("opacity",".6");
					$("#alarmMsg").text("基金未授权,将转接到授权页面.");
					setTimeout(function(){
						$("#promptBox").remove("slow");
						//location.href = "/mobile/myfund/fund-reg.html?fundLoginNumber="+fundLoginNumber+"&fundCertificatetype="+fundCertificatetype+"&mobile="+phoneNum;
						var param = "fundLoginNumber="+fundLoginNumber+"&fundCertificatetype="+fundCertificatetype+"&mobile="+phoneNum;
						gotoLocation("/mobile/myfund/fund-reg.html",param);
					},2000);
				}else{
					closeInitPrompt("网络异常，请检查网络后重试");
				}
			}else if(resultCode == "500803"){
				$("#initMessageBox").css("opacity",".6");
				$("#alarmMsg").text("基金未登录,将转接到基金登录页面."); 
				setTimeout(function(){
					$("#promptBox").remove("slow");
					//location.href = "/mobile/user-yz.html?tourl="+successForwardUrl;
					var param = "tourl="+successForwardUrl;
					gotoLocation("/mobile/user-yz.html",param)
				},2000);
			}else if(resultCode == "500802"){
				$("#initMessageBox").css("opacity",".6");
				$("#alarmMsg").text("基金未登录,将转接到基金OTP登录页面."); 
				setTimeout(function(){
					$("#promptBox").remove("slow");
					//location.href = "/mobile/user_otpyz.html?tourl="+successForwardUrl;
					var param = "tourl="+successForwardUrl;
					gotoLocation("/mobile/user_otpyz.html",param)
				},2000);
			}else if(resultCode == "500702"){
				checkLogin(resultCode,successForwardUrl,"登录过期");
			}else{
				var resultMessage = fundDetail.resultMessage;
				closeInitPrompt((resultMessage!="")?resultMessage:"网络异常，请检查网络后重试");
			}
		},
		error: function(XMLHttpRequest,textStatus,errorThrown){
			if(textStatus == "error"){
				closeInitPrompt("网络异常，请检查网络后重试");
			}else{
				closeInitPrompt((errorThrown!="")?errorThrown:"网络异常，请检查网络后重试");
			}
		}
	});
}
/*
 * 初始化银行列表
 * 银行标识对应关系：
 * 4：工商银行，A：农业银行，B：建设银行，C：交通银行，G：招商银行，L：平安银行
 */
function initBankList(sessionKey){
	$.ajax({
		type: "post",
		url: mpsurl+"/mobile/fund/fundBankList.do",
		dataType: "text",
		data:{sessionKey:sessionKey},
		success: function(data){
			var bankInfo = eval("("+data+")");
			var resultCode = bankInfo.resultCode;
			if(resultCode == "500600"){
				// 关闭初始化提示框
				$("#promptBox").remove("slow");
				var bankList = bankInfo.bankList;
				// 可用账号id绑定变量_bankCount
				var _bankCount = 0;
				for(var k = 0;k < bankList.length;k ++){
					// 交易账号
					var tradeacco = bankList[k].tradeacco;
					// 银行卡类型
					var capitalmode = bankList[k].capitalmode;
					// 银行帐号
					var bankacco = bankList[k].bankacco;
					// 可赎回金额
					var ftmaxsharelimit = bankList[k].ftmaxsharelimit;
					if(""==ftmaxsharelimit||null==ftmaxsharelimit||"null"==ftmaxsharelimit||undefined==ftmaxsharelimit){
						ftmaxsharelimit = "0";
					}
					// 银行名称
//					var bankName = bankList[k].bankName;
					// 主交易账号标示Y：主交易账号 N：非主交易账号
					var mainflag = bankList[k].mainflag;
					if(capitalmode == "L" || capitalmode == "G" || capitalmode == "4" || capitalmode == "A" || capitalmode == "C" || capitalmode == "B"){
						// 需要根据银行标志符进行银行名和银行log设置
						var bankName = showBankNameByFlag(capitalmode);
						var imageName = getBankLogImg(capitalmode);
						var perBankInfo = "<li id='_bankList"+_bankCount+"'>" +
								"<div class='info-shadow'>" +
								"<div class='info-shadow-cont'>" +
								"<div class='shadow-cont-left'>" +
								"<div style='display: none;'>" +
								"<input id='tradeId"+_bankCount+"' value='"+tradeacco+"'/>" +
								"<input id='bankTypeId"+_bankCount+"' value='"+capitalmode+"'/>" +
								"<input id='mainFlagId"+_bankCount+"' value='"+mainflag+"'/>" +
								"</div>" +
								"<img src='../images/"+imageName+"' alt='"+bankName+"'>" +
								"</div>" +
								"<div class='shadow-cont-main'>" +
								"<p id='bankNameId"+_bankCount+"'>"+bankName+"</p><p id='bankAccId"+_bankCount+"'>"+bankacco+"</p>" +
								"</div>" +
								"<div class='shadow-cont-right'>" +
								"<p>可赎回金额</p><p><span id='maxShareId"+_bankCount+"' class='fn32 fn-c-fe6200'>"+ftmaxsharelimit+"</span>元</p>" +
								"</div>" +
								"</div>" +
								"</div>" +
								"</li>";
						$("#bankList").append(perBankInfo);
						_bankCount ++;
					}
				}
				choiceBank();
				bankIscroll();
				bankScroll = new iScroll("content2");
			}else{
				if(resultCode=="500702" || resultCode=="500802" || resultCode=="500803"){
					var tourl = "/mobile/myfund/mszq.html?sessionKey="+sessionKey;
					checkLogin(resultCode,tourl,"");
				}else{
					var resultMessage = bankInfo.resultMessage;
					closeInitPrompt((resultMessage!="")?resultMessage:"网络异常，请检查网络后重试");
				}			
			}
		},
		error: function(XMLHttpRequest,textStatus,errorThrown){
			closeInitPrompt((errorThrown!="")?errorThrown:"网络异常，请检查网络后重试");
		}
	});
}
//  获取令牌和是否授权+otp登录标识(fundInitFlag)方法
function getSessionKey(requestMsg){
	var returnVal = "";
	returnVal = getQueryParam(requestMsg);
	/*
	var localUrl = location.href;
	if(localUrl.indexOf("?") != -1){
		var paramInfo = localUrl.substr(localUrl.indexOf("?")+1);
		if(paramInfo.indexOf("&") != -1){
			var paramArray = paramInfo.split("&");
			for(var k = 0;k < paramArray.length;k ++){
				if((paramArray[k].split("="))[0] == requestMsg){
					returnVal = (paramArray[k].split("="))[1];
				}
			}
		}else{
			if(paramInfo.split("=")[0]==requestMsg){
				returnVal = paramInfo.split("=")[1];
			}
		}
	}*/
	return returnVal;
}
// 添加主页面滚动
function mainIscroll(){
	$("#wrap").css("height",$(window).height());
	var wh = $(window).height()-$("#mainContent").find("header").height(); 
	$("#content").css("height",wh+"px");
	
}
//添加银行页面滚动
function bankIscroll(){
	var wh = $(window).height()-$("#chooseChque").find("header").height();
	$("#content2").css("height",wh+"px");
}

/*
 * 初始化页面提示框
 * author sudeming
 */
function initPrompt(msg){
	var promptBox = "<div id='promptBox' style='position:fixed;left:0;top:0;width:100%;height:100%;z-index:1000;display: block;'>"+
		"<div id='alamBoxForInput'style='position:absolute;width:100%;height:100%;background-color:#000;opacity:.5;z-index:1000;'></div>"+
		"<div style='position: fixed;left: 50%;top: 30%;width: 360px;margin-left: -150px;z-index: 1001;'>"+
		"<div id='initMessageBox' style='position: absolute;width: 100%;height: 100%;background: #000;-webkit-border-radius: 8px;border-radius: 8px;opacity: .0;z-index: 1;'>"+
		"</div>"+
		"<div id='alarmMsg' style='position: relative;display: -webkit-box;color: #fff;min-height:44px;-webkit-box-orient: horizontal;-webkit-box-pack: center;padding:28px 18px;font-size: 30px;text-align: center;z-index: 2;'>"+
		msg+"</div>"+
		"</div>"+
		"</div>";
	$("body").append(promptBox);
}
// 页面初始化错误时关闭提示框的方法
function closeInitPrompt(resultMessage){
	$("#initMessageBox").css("opacity",".6");
	$("#alarmMsg").text(resultMessage);
	setTimeout(function(){
		$("#promptBox").remove("slow");
		//location.href="/mobile/index.html";
		gotoLocation("/mobile/index.html","");
	},2000);
}


//页面数据校验
function validateData(){
	
	// 购买基金
	buyFund();
	
	// 售出基金
	saleFund();

	// 展示银行卡页面
	chooseBank();
	
	// 返回基金页面
	returnFund();
}

// 购买基金方法
function buyFund(){
	$("#getFund").on("tap",function(){
		$("#_tabBuyBtn").focus();
		var bankInfo = $("#bankInfo").text();
		if(bankInfo == ""||bankInfo == "请选择银行卡"){
			setPromptForInput("请选择银行卡.");
			return;
		}
		var mainFlagId = $("#_bankFlagForBuy").val();
		
		if(mainFlagId == "L" || mainFlagId == "G" || mainFlagId == "4"){
			var sumInput = $("#buySumInput").val();
			if(isNaN(sumInput) || sumInput == "" || sumInput == 0){
				setPromptForInput("请填写正确的金额.");
				return;
			}
			var passInput = $("#buyPass").val();
			if(passInput == ""){
				setPromptForInput("请输入交易密码.");
				return;
			}
			dealFund(sumInput,passInput);
		}
	});
}

// 购买基金Ajax方法
function dealFund(sumInput,passInput){
	// 打开状态窗口
	initPrompt("<img src='../images/loading.gif' width='70px' height='70px'/>");
	// 交易账号
	var tradeacco = $("#tradeaccBuy").val();
	// 基金令牌
	var sessionKey = $("#sessionKey").val();
	// 购买金额applysum;交易密码tradepassword
	$.ajax({
		type: "post",
		url: mpsurl+"/mobile/fund/tradePurchase.do",
		dataType: "text",
		data: {tradeacco:tradeacco,applysum:sumInput,tradepassword:passInput,sessionKey:sessionKey},
		success: function(data){
			// 关闭旋转等待提示框
			$("#promptBox").remove("slow");
			var returnInfo = eval("("+data+")");
			var resultCode = returnInfo.resultCode;
			var resultMessage = returnInfo.resultMessage;
			if(resultCode == "500600"){
				var nowTime = new Date();
				var year = nowTime.getFullYear();
				var month = nowTime.getMonth();
				var day = nowTime.getDay();
				var hours = nowTime.getHours();
				var minutes = nowTime.getMinutes();
				var seconds = nowTime.getSeconds();
				
				var applyDate = year+"-"+month+"-"+day+" "+hours+":"+minutes+":"+seconds;
				// 基金号
				var applySerial = returnInfo.applySerial;
				// 打开成功提示框，在关闭提示框的时候进行页面刷新
				var bankInfo = $("#bankInfo").text();
				$("#messageBox").html(resultMessage);
				$("#messageBox1").html("购买金额："+sumInput);
				$("#messageBox2").html("付款银行："+bankInfo);
				$("#messageBox3").html("交易时间："+applyDate);
				$("#messageBox4").html("交易单号："+applySerial);
				$("#successPrompt").show();
				$("#successPromptCloseBtn").on("tap", function(){
					$("#successPrompt").hide();
					//location.href="/mobile/myfund/mszq.html?sessionKey="+sessionKey;
					var param = "sessionKey="+sessionKey;
					gotoLocation("/mobile/myfund/mszq.html",param);
				});
			}else{
				if(resultCode=="500702" || resultCode=="500802" || resultCode=="500803"){
					var tourl = "/mobile/myfund/mszq.html?sessionKey="+sessionKey;
					checkLogin(resultCode,tourl,"");
				}else{
					$("#errorMessageBox").html((resultMessage!="")?resultMessage:"网络异常，请检查网络后重试");
					$("#errorPrompt").show();
					$("#errorPrompt").on("tap", function(){
						$("#errorPrompt").hide();
					});
				}
			}
		},
		error: function(XMLHttpRequest,textStatus,errorThrown){
			// 关闭旋转等待提示框
			$("#promptBox").remove("slow");
			$("#errorMessageBox").html((errorThrown!="")?errorThrown:"网络异常，请检查网络后重试");
			$("#errorPrompt").show();
			$("#errorPrompt").on("tap", function(){
				$("#errorPrompt").hide();
			});
		}
	});
}

// 售出基金
function saleFund(){
	$("#saleFund").on("tap",function(){
		var bankInfoSale = $("#bankInfoSale").text();
		if(bankInfoSale == ""||bankInfoSale == "请选择银行卡"){
			setPromptForInput("请选择银行卡.");
			return;
		}
		var mainFlagId = $("#_bankFlagForSale").val();
		if(mainFlagId == "L" || mainFlagId == "G" || mainFlagId == "4" || mainFlagId == "A" || mainFlagId == "C" || mainFlagId == "B"){
			var lotInput = new Number($("#saleLotInput").val()).toFixed(2);
			var maxLot = new Number($("#saleLot").text()).toFixed(2);
			if(isNaN(lotInput) || lotInput == "" || lotInput == 0){
				setPromptForInput("请填写正确的金额.");
				return;
			}else{
				if((lotInput - maxLot) > 0){
					setPromptForInput("可赎回金额不足，请减少金额后再赎回.");
					return;
					
				}
			}
			var passInput = $("#salePass").val();
			if(passInput == ""){
				setPromptForInput("请输入交易密码.");
				return;
			}
			repealFund(lotInput,passInput);
		}
	});
}
// 售出基金Ajax方法
function repealFund(lotInput,passInput){
	// 打开状态窗口
	initPrompt("<img src='../images/loading.gif' width='70px' height='70px'/>");
	// 交易账号
	var tradeacco = $("#tradeaccSale").val();
	// 基金令牌
	var sessionKey = $("#sessionKey").val();
	// 售出金额applysum;交易密码tradepassword
	$.ajax({
		type: "post",
		url: mpsurl+"/mobile/fund/fundSale.do",
		dataType: "text",
		data: {tradeacco:tradeacco,applysum:lotInput,tradepassword:passInput,sessionKey:sessionKey},
		success: function(data){
			// 关闭旋转等待提示框
			$("#promptBox").remove("slow");
			var returnInfo = eval("("+data+")");
			var resultCode = returnInfo.resultCode;
//			var resultCode = returnInfo.returnCode;
			var resultMessage = returnInfo.resultMessage;
			if(resultCode == "500600"){
				// 交易时间
//				var applyDate = returnInfo.applyDate;
				var nowTime = new Date();
				var year = nowTime.getFullYear();
				var month = nowTime.getMonth();
				var day = nowTime.getDay();
				var hours = nowTime.getHours();
				var minutes = nowTime.getMinutes();
				var seconds = nowTime.getSeconds();
				
				var applyDate = year+"-"+month+"-"+day+" "+hours+":"+minutes+":"+seconds;
				// 基金号
				var applySerial = returnInfo.applySerial;
				// 先关闭旋转等待提示框，打开成功提示框，在关闭提示框的时候进行页面刷新
				var bankInfoSale = $("#bankInfoSale").text();
				$("#messageBox").html(resultMessage);
				$("#messageBox1").html("赎回金额："+lotInput);
				$("#messageBox2").html("付款银行："+bankInfoSale);
				$("#messageBox3").html("交易时间："+applyDate);
				$("#messageBox4").html("交易单号："+applySerial);
				$("#successPrompt").show();
				$("#successPromptCloseBtn").on("tap", function(){
					$("#successPrompt").hide();
					//location.href="/mobile/myfund/mszq.html?sessionKey="+sessionKey;
					var param = "sessionKey="+sessionKey;
					gotoLocation("/mobile/myfund/mszq.html",param);
				});
				
			}else{
				if(resultCode=="500702" || resultCode=="500802" || resultCode=="500803"){
					var tourl = "/mobile/myfund/mszq.html?sessionKey="+sessionKey;
					checkLogin(resultCode,tourl,"");
				}else{
					$("#errorMessageBox").html((resultMessage!="")?resultMessage:"网络异常，请检查网络后重试");
					$("#errorPrompt").show();
					$("#errorPrompt").on("tap", function(){
						$("#errorPrompt").hide();
					});
				}
			}
		},
		error: function(XMLHttpRequest,textStatus,errorThrown){
			// 关闭旋转等待提示框
			$("#promptBox").remove("slow");
			$("#errorMessageBox").html((resultMessage!="")?resultMessage:"网络异常，请检查网络后重试");
			$("#errorPrompt").show();
			$("#errorPrompt").on("tap", function(){
				$("#errorPrompt").hide();
			});
		}
	});
}

//选择银行
function chooseBank(){
	$("#bankInfoSale").on("tap",function(callback){
		$(this).focus();
		isBuy = false;
		var _bankListLen = $("#bankList").find("li").length;
		for(var i = 0;i < _bankListLen;i ++){
			$("#_bankList"+i).show();
		}
		$("#mainContent").hide();
		showBankInfo($("#chooseChque"));
		setTimeout(function(){
			bankIscroll();
			bankScroll.refresh();
		},200);
	});
	$("#bankInfo").on("tap",function(){
		$(this).focus();
		isBuy = true;
		var _bankListLen = $("#bankList").find("li").length;
		for(var i = 0;i < _bankListLen;i ++){
			var _bankType = $("#bankTypeId"+i).val();
			if(_bankType!="L"&&_bankType!="G"&&_bankType!="4"){
				$("#_bankList"+i).hide();
			}
		}
		$("#mainContent").hide();
		showBankInfo($("#chooseChque"));
		setTimeout(function(){
			bankIscroll();
			bankScroll.refresh();
		},200);
	});
}
// 选择银行的时候的事件监听
function choiceBank(){
	$("#bankList li").on("tap", function(){
		var liId = $(this)[0].id;
		var i = liId.replace("_bankList","");
		// 交易账号
		var tradeacco = $("#tradeId"+i).val();
		// 银行标识
		var _bankTypeId = $("#bankTypeId"+i).val();
		// 银行名称，根据类型显示银行名称，工，农，建需要加中国；
		var bankName = showBankNameByFlag(_bankTypeId);
		// 银行帐号
		var bankAccount = $("#bankAccId"+i).text();
		// 最大赎回金额
		var saleLot = $("#maxShareId"+i).text();
		// 设置赎回页面银行信息
		if(!isBuy){
			$("#tradeaccSale").val(tradeacco);
			$("#_bankFlagForSale").val(_bankTypeId);
			$("#bankInfoSale").html(bankName + " " + bankAccount);
			if(saleLot == ""||null == saleLot||"null"==saleLot||undefined==saleLot){
				$("#saleLot").html("0");
			}else{
				$("#saleLot").html(saleLot);
			}
		}
		
		// 设置购买基金页面信息
		if(isBuy){
			$("#tradeaccBuy").val(tradeacco);
			$("#_bankFlagForBuy").val(_bankTypeId);
			$("#bankInfo").html(bankName + " " + bankAccount);
		}
		
		// 切换页面
		hideBankInfo($("#chooseChque"),function(){
			$("#mainContent").show();
			setTimeout(function(){
				mainIscroll();
				mainScroll.refresh();
			},200);
		});
	});
}

//返回基金页面
function returnFund(){
	$("#returnFund").on("tap", function(event){
		hideBankInfo($("#chooseChque"), function(){
			$("#mainContent").show();
			setTimeout(function(){
				mainIscroll();
				mainScroll.refresh();
				event.stopPropagation();
			},200);
		});
	});
}

// 返回主页
function returnHome(){
	$("#returnHome").on("tap", function(){
		/*
		//安卓关闭键盘
		var ua = navigator.userAgent;
		if(ua.indexOf("iPhone")>=0){
		}else{
			window.pa_app.closeKeyboard();
		}
		*/
		setTimeout(function(){
			gotoLocation("/mobile/index.html","");
		},200);
	});
}

// 银行卡向上展开效果
function showBankInfo(obj, callback){
	obj.css("-webkit-transform", "translate3d(0px, " + window.innerHeight + "px, 0px);");
	obj.show().animate({
            "-webkit-transform": "translate3d(0px, 0px, 0px);"}
        , 300, "ease-in-out", callback);
}
// 银行卡向下隐藏效果
function hideBankInfo(obj, callback) {
	obj.animate({
            "-webkit-transform": "translate3d(0px, " + window.innerHeight + "px, 0px);"}
        , 300, "ease-in-out", function(){
        	obj.hide();
            callback();
        });
}
// 根据类型来设置银行显示名称 4：工商银行，A：农业银行，B：建设银行，C：交通银行，G：招商银行，L：平安银行
function showBankNameByFlag(capitalmode){
	var _bankPramater = {"4":"中国工商银行","A":"中国农业银行","B":"中国建设银行","C":"交通银行","G":"招商银行","L":"平安银行"};
	var bankName = "";
	for(var bfi in _bankPramater){
		if(bfi == capitalmode){
			bankName = _bankPramater[bfi];
		}
	}
	return bankName;
}
// 根据银行类型来设置银行的Log
function getBankLogImg(capitalmode){
	var _bankPramater = {"4":"bank_icbc.gif","A":"bank_abc.gif","B":"bank_ccb.gif","C":"bank_bankcomm.gif","G":"bank_cmbchina.gif","L":"bank_pingan.gif"};
	var imageName = "";
	for(var bfi in _bankPramater){
		if(bfi == capitalmode){
			imageName = _bankPramater[bfi];
		}
	}
	return imageName;
}
// 当获取到输入焦点时，不允许切换tab页签
function noResizeForInput(){
	$("#buySumInput,#buyPass,#saleLotInput,#salePass").on("tap",function(){
		isInputVal = true;
		inputId = $(this).attr("id");
	}).on("focus", function(){
		if(isIphoneOS){
			$("#_tabBuyBtn,#_tabSaleBtn").unbind("tap");
			oldWrapHeight = $(window).height();
		}
	}).on("blur", function(){
		if(isIphoneOS){
			$("#J-TabsTitle").find("li").bind("tap", function(){
			    var index = tabsTitle.index(this);
			    $(this).addClass("curr").siblings().removeClass("curr");
			    tabsContent.hide().eq(index).show();
				setTimeout(function(){
					mainIscroll();
					mainScroll.refresh();
				},200);
			});
		}
	});
}